//
//  HealthNewsDetailView.m
//  LoveHealth
//
//  Created by lanou3g on 14-9-18.
//  Copyright (c) 2014年 lanou. All rights reserved.
//

#import "HealthNewsDetailView.h"


#define TopHeight  220
@interface HealthNewsDetailView ()
//- (void)p_setupSubviews;
@end

@implementation HealthNewsDetailView
- (void)dealloc
{
//    self.newsDetailImageView = nil;
//    self.titleLabel = nil;
//    self.scrollView = nil;
//    self.textLabel = nil;
    self.newsDetail = nil;
    [super dealloc];
}
- (id)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        // Initialization code
//        [self p_setupSubviews];
    }
    return self;
}
- (void)setNewsDetail:(HealthNewsDetail *)newsDetail
{
    if (_newsDetail != newsDetail) {
        [_newsDetail release];
        _newsDetail = [newsDetail retain];
    }
    [self.detailWebView loadHTMLString:newsDetail.message baseURL:nil];
    self.detailTitleLabel.text = newsDetail.title;
    self.detailImageView.image = newsDetail.showImage;
}
//- (void)p_setupSubviews
//{
//    //添加scrollView  滚动视图
//    _scrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 89, self.frame.size.width, self.frame.size.height - 64-49)];
////    _scrollView.backgroundColor = [UIColor redColor];
//    
//    [self addSubview:_scrollView];
//    
//    
//    //添加title  资讯标题
//    _titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 64, self.bounds.size.width, 25)];
//    _titleLabel.backgroundColor = [UIColor grayColor];
//    _titleLabel.font = [UIFont systemFontOfSize:13.0];
//    _titleLabel.textAlignment = NSTextAlignmentCenter;
//    [self addSubview:_titleLabel];
//    
//    
//    
//    //添加ImageView
//    _newsDetailImageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 320, 215)];
//   
//   
//    
//    _newsDetailImageView.backgroundColor = [UIColor blackColor];
//    [_scrollView addSubview:_newsDetailImageView];
//    
//    
//    //添加资讯内容
//    _textLabel = [[UILabel alloc] initWithFrame:CGRectMake(10, TopHeight, self.bounds.size.width - 20, 0)];
////    _textLabel.backgroundColor = [UIColor orangeColor];
//    _textLabel.font = [UIFont systemFontOfSize:15.0];
//    _textLabel.numberOfLines = 0;
//    [_scrollView addSubview:_textLabel];
//    
//}
//
//- (void)adjustSubviewsWithContent:(NSString *)content
//{
//    //计算文本内容的高度
//    CGRect contentRect = [content boundingRectWithSize:CGSizeMake(self.frame.size.width, 10000) options:NSStringDrawingUsesLineFragmentOrigin attributes:@{NSFontAttributeName:[UIFont systemFontOfSize:12.0]} context:nil];
//    
//    CGFloat height = TopHeight+contentRect.size.height+30;
//    
//    if (height < self.bounds.size.height) {
//        
//        height = self.bounds.size.height + 30;
//    }
//    
//    _scrollView.contentSize = CGSizeMake(self.bounds.size.width, height);
//    
//    
//    
//    CGRect contentViewRect = _textLabel.frame;
//    contentViewRect.size.height = contentRect.size.height;
//    _textLabel.frame = contentViewRect;
//    
//    
//}
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect
{
    // Drawing code
}
*/

@end
